package com.example.service.impl;

import com.example.mapper.BrandMapper;
import com.example.mapper.GoodMapper;
import com.example.mapper.GoodTypeMapper;
import com.example.mapper.SupplierMapper;
import com.example.pojo.*;
import com.example.service.GoodService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodServiceImpl implements GoodService {
    @Autowired
    private GoodMapper goodMapper;


    @Override
    public PageBean getGood(Good good, Integer page, Integer pageSize) {
        //设置分页参数
        PageHelper.startPage(page,pageSize);
        List<Good> list = goodMapper.getGood(good);
        Page<Good> p= (Page<Good>) list;
        PageBean pageBean=new PageBean(p.getTotal(),p.getResult());
        return pageBean;

    }

    @Override
    public void deleteGood(String id) {
        goodMapper.deleteGood(id);
    }

    @Override
    public void updateGood(Good good) {
        goodMapper.updateGood(good);
    }

    @Override
    public void addGood(Good good) {
        goodMapper.addGood(good);
    }

    @Override
    public void numChange(String goodCode, Integer sealNum) {
        goodMapper.numChange(goodCode,sealNum);
    }

}
